# frozen_string_literal: true

class PicturesController < Admin::ApplicationController
  def index
    @pictures = Picture.all
  end

  def new
    @picture = Picture.new
  end

  def create
    Picture.create!(picture_params)
    redirect_to pictures_url
  end

  def destroy
    @picture = Picture.find(params[:id])
    @picture.destroy
    redirect_to pictures_url
  end

  def picture_params
    params.require(:picture).permit(:name, :image)
  end
 end
